home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / FROMUTS / FUNK / !FunkyDemo / !S_Tracker / !Help < prev    next >
Text File  |  1991-05-23  |  23KB  |  635 lines

  1. !S/Tracker (Soundtracker/Tracker module music player)
  2. -----------------------------------------------------
  3.  
  4. Version 4.00 (23 May 1991)
  5.  
  6. Originally written by Hugo Fiennes and Fabrice Mercier [(c) The Serial Port]
  7. SWI interface and other bits added by Matt Farrow
  8.  
  9.  
  10. You are allowed to use this module with any demos or p.d. stuff you write,
  11. but permission is required before you can use it in any commercial software.
  12.  
  13. The !S/Tracker application may be freely copied if nothing more than the
  14. cost of a disc and a small amount for the trouble is charged, but it must be
  15. distributed with all the files complete and unchanged.
  16.  
  17.  
  18. DOCUMENTATION OF * COMMANDS AND SWI's
  19. -------------------------------------
  20.  
  21. *PlayMod     - Loads into memory and starts to play the specified Tracker or
  22.                Soundtracker module, determining automatically which format it
  23.                is.
  24.  
  25.                Syntax: *PlayMod <filename>
  26.          
  27.  
  28.  
  29.  
  30. *PlayPause   - Will pause the currently playing tune (kills all sound immed-
  31.                iately) but retains the soundtracker/tracker module in memory.
  32.                The tune can be restarted with a *PlayStart command.
  33.  
  34.                Syntax: *PlayPause
  35.  
  36.  
  37.  
  38.  
  39. *PlayStart   - Will resume playing a tune after a *PlayPause command.
  40.  
  41.                Syntax: *PlayStart
  42.  
  43.  
  44.  
  45.  
  46. *PlayPos     - Will set the current position in the sequence table, or if no
  47.                parameter is given, will simply return the current position.
  48.  
  49.                Syntax: *PlayPos [<0-127>]
  50.  
  51.                 
  52.  
  53.  
  54. *PlaySamples - Will list all the samples associated with the currently
  55.                installed music module. 
  56.  
  57.                Syntax: *PlaySamples
  58.  
  59.  
  60.  
  61.  
  62. *PlayStatus  - Will print information about the current tune module loaded
  63.                
  64.                Syntax: *PlayStatus
  65.  
  66.  
  67.  
  68.  
  69. *PlayStereo  - Controls the stereo settings while the older format sound-
  70.                tracker modules are playing (the stereo is fixed on an Amiga),
  71.                and will switch between five possible settings to cater for
  72.                most configurations:
  73.                    0 - Slightly off-centre left and right (normal)
  74.                    1 - Fully left and right (amiga-style)
  75.                    2 - Fully left
  76.                    3 - Fully right
  77.                    4 - Don't alter stereo settings
  78.                           (normally alters settings when a tune is loaded                               and when it plays a tracker stereo command - see
  79.                            SWI Tracker_Stereo)
  80.  
  81.                Syntax: *PlayStereo <0|1|2|3>
  82.  
  83.  
  84.  
  85.  
  86. *PlayStop    - Will stop and kill the currently playing tune module,
  87.                removing it from memory.
  88.  
  89.                Syntax: *PlayStop
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. SWI COMMANDS
  99. ------------
  100. Several SWI commands have been added to the module in order to simplify the
  101. task of adding soundtracker/tracker music to your demos etc. (especially
  102. multi-tasking situations). These provide all of the facilities offered by
  103. the various * commands, but also allow a more detailed control of some of the
  104. module's features.
  105. All the SWI's remain in SVC mode, and do not alter the interrupt status.
  106. I think most are re-entrant, except those which use system SWI's (load, play,
  107. stop etc.), so avoid calling them from interrupts if you can avoid it.
  108.  
  109. The SWI chunk number given here (&43200) is an officially recognised chunk
  110. number issued by Acorn.
  111.  
  112.  
  113. -----------------------------------------------------------------------------
  114. Tracker_Version        (SWI &43200)
  115. -----------------------------------------------------------------------------
  116.  
  117. On Entry:  -
  118.  
  119. On Exit :  R0 = version number*100  (ie. for V1.23 = 123)
  120.  
  121. Use this call to ensure that the trackermodule installed is a recent enough
  122. version to support the SWI's you wish to use. Versions 4.00 onwards incorpor-
  123. ate the SWI's.
  124.  
  125.  
  126.  
  127.  
  128. -----------------------------------------------------------------------------
  129. Tracker_Load           (SWI &43201)
  130. -----------------------------------------------------------------------------
  131.  
  132. On Entry:  R0 = pointer to filename of soundtracker/tracker module
  133.  
  134. On Exit :  R0 preserved
  135.  
  136. This call will claim memory from the RMA and load the specified tune module,
  137. initialise the sound system, and set the playroutine in pause mode.
  138. You must then use the SWI Tracker_Play to start the tune playing.
  139. The command *PlayMod calls this routine, and then the SWI Tracker_Play.
  140.  
  141. An error will be generated if the module cannot be loaded or not enough
  142. memory can be claimed.
  143.  
  144.  
  145.  
  146.  
  147. -----------------------------------------------------------------------------
  148. Tracker_MemoryLoad     (SWI &43202)
  149. -----------------------------------------------------------------------------
  150.  
  151. On Entry:  R0 = pointer to first word of soundtracker/tracker module in
  152.                 memory (NB must be word-aligned)
  153.            R1 = length of module in bytes
  154.  
  155. On Exit :  R0 and R1 preserved
  156.  
  157. This call can be used by a non-multitasking application to specify an area
  158. of memory as a tune module, and thereby remove the need for a seperate file
  159. to hold a tune, and there is no need to claim a large amount of RMA space.
  160. Once this SWI is called, the module will be treated as if it was loaded in
  161. the module's own workspace.
  162.  Important: You must tell the trackermodule to forget the module if the
  163. memory will be overwritten, otherwise the module may crash.
  164. (*PlayStop or Tracker_Stop SWI)
  165.  
  166. NB This call will not work for programs running under the desktop if the
  167.    module is loaded in user memory.
  168.  
  169.    When a soundtracker module is loaded, it is partially converted to an
  170.    intermediate format between soundtracker and tracker to simplify the task
  171.    for the playroutine. Once the module is loaded (by any method) it is
  172.    permanently corrupted, and should not be re-saved. Tracker modules will be
  173.    unchanged, however, and soundtracker modules should be converted fully
  174.    into this format before being loaded to avoid this problem.
  175.  
  176.                                                               
  177.  
  178.  
  179. -----------------------------------------------------------------------------
  180. Tracker_Play           (SWI &43203)
  181. -----------------------------------------------------------------------------
  182.  
  183. On Entry:  -
  184.  
  185. On Exit :  -
  186.  
  187. This call will restart a tune after it has been paused or loaded with the
  188. Tracker_Load SWI.
  189.  
  190.  
  191.  
  192.  
  193.  
  194. -----------------------------------------------------------------------------
  195. Tracker_Stop           (SWI &43204)
  196. -----------------------------------------------------------------------------
  197.  
  198. On Entry:  -
  199.  
  200. On Exit :  -
  201.  
  202. This performs the same actions as *PlayStop
  203. Using *PlayStop or this SWI is the only way to get the trackermodule to
  204. release the memory taken up by the tune module, or to force it to forget the
  205. address of a module if it has been loaded with the 'Tracker_MemoryLoad' SWI.
  206.  
  207.  
  208.  
  209.  
  210. -----------------------------------------------------------------------------
  211. Tracker_Pause          (SWI &43205)
  212. -----------------------------------------------------------------------------
  213.  
  214. On Entry:  -
  215.  
  216. On Exit :  -
  217.  
  218. This performs the same actions as *PlayPause
  219.  
  220.  
  221.  
  222.  
  223.  
  224. -----------------------------------------------------------------------------
  225. Tracker_Stereo         (SWI &43206)
  226. -----------------------------------------------------------------------------
  227.  
  228. On Entry:  R0 = Stereo setting (0-4)
  229.  
  230. On Exit :  R0 preserved
  231.  
  232. This performs the same actions as *PlayStereo, with R0 passed as a parameter.
  233. If R0 is set to 4 on entry, then the stereo settings will be unaltered
  234. whenever a module is loaded or killed, and disables any stereo commands in
  235. tracker modules. This is to allow interfacing programs to provide their own
  236. stereo options, or to allow adjustment to the stereo positions while tracker
  237. tunes are playing (which have default stereo settings stored as part of the
  238. tune).
  239.  
  240.  
  241.  
  242.  
  243. -----------------------------------------------------------------------------
  244. Tracker_SetPos         (SWI &43207)
  245. -----------------------------------------------------------------------------
  246.  
  247. On Entry:  R0 = New sequence position (0-127 max)
  248.            R1 = Event (0-63 max)
  249.  
  250. On Exit :  R0 preserved
  251.  
  252. This performs the same actions as *PlayPos, except that the event with the
  253. pattern can be specified (0-63 normally). If an event number higher than the
  254. number of events in the current pattern is specified, the pattern will begin
  255. at event 0.
  256.  
  257. If there is no tune currently loaded, an error is generated.
  258.  
  259.  
  260.  
  261.  
  262.  
  263. -----------------------------------------------------------------------------
  264. Tracker_ReadPos        (SWI &43208)
  265. -----------------------------------------------------------------------------
  266.  
  267. On Entry:  -
  268.  
  269. On Exit :  R0 = Current position in sequence table (0-127 max)
  270.            R1 = Current position in pattern (0-63 max)
  271.            R2 = Maximum position in sequence table
  272.  
  273. This performs the same actions as *PlayPos with no parameters, but also
  274. returns the current position in the current pattern (in case some applic-
  275. ations need to synchronize events with the tune being played).
  276.  
  277.  
  278.  
  279.  
  280.  
  281. -----------------------------------------------------------------------------
  282. Tracker_PlayNote       (SWI &43209)
  283. -----------------------------------------------------------------------------
  284.  
  285. On Entry:  R0 = Sound channel to sound note on (1-8 max)
  286.            R1 = Tracker format note number (1-36)
  287.            R2 = Sample to play (1-36)
  288.            R3 = Volume (0-255)
  289.  
  290. On Exit :  R0-R3 preserved
  291.            If tune not paused then C flag set otherwise C flag cleared.
  292.  
  293. If there is no tune loaded, an error will be generated.
  294.  
  295. It plays one of the samples which are part of the paused tune at a given
  296. pitch (1=low, 36=high) and volume (0=silent, 255=loud). If any of the values
  297. are out of range, an error will be reported.
  298. The number of sound channels that can be used depends on the module loaded
  299. (soundtracker modules will always use 4 voices, whereas Tracker modules can
  300. use up to 8).
  301. Use the Tracker_TuneInfo SWI to find out the maximum number of voices if you
  302. intend to play more than one note at a time.
  303. NB This call should be avoided if possible, unless the purpose is to hear
  304.    each sample seperately.
  305.  
  306.  
  307.  
  308.  
  309.  
  310. -----------------------------------------------------------------------------
  311. Tracker_TuneInfo       (SWI &4320A)
  312. -----------------------------------------------------------------------------
  313.  
  314. On Entry:  -
  315.  
  316. On Exit :  R0 = Sequence table length (1-128)
  317.            R1 = Number of voices (1-8)
  318.            R2 = Current speed (1-15)
  319.            R3 = Pointer to tune name (terminated by 0, max length 32 chars)
  320.            R4 = Pointer to author's name (0 terminated, max length 32 chars)
  321.                 or zero if soundtracker format module (not applicable)
  322.            R5 = Address of currently loaded tune module
  323.  
  324.            If the tune is paused, the C flag is set, otherwise the C flag is
  325.            cleared.
  326.  
  327.            If there is no tune loaded, R0 is set to zero, and R1-R5 are
  328.            preserved.
  329.                                                                    
  330.  
  331. This call provides miscellaneous information about the tune currently loaded.
  332.  
  333. You should not need to directly access the tune module (using the address
  334. passed in R5), because all information is available via the various SWI's,
  335. and soundtracker format modules will have been converted partially to Tracker
  336. format when loaded (and therefore in an unknown format). This information is
  337. provided if, for example, multi-tasking players/editors need to know if the
  338. tune currently playing is running from ordinary RMA, or the player's/editor's
  339. own workspace.
  340.  
  341.  
  342.                    
  343.  
  344.  
  345.  
  346. -----------------------------------------------------------------------------
  347. Tracker_SoundInfo      (SWI &4320B)
  348. -----------------------------------------------------------------------------
  349.  
  350. On Entry:  R0 = Pointer to word-aligned 256 byte block to hold sound data
  351.  
  352. On Exit :  R0 preserved
  353.               
  354.            if the tune is paused, the C flag will be set, otherwise the C
  355.            flag will be cleared.
  356.  
  357. If there is no tune loaded an error will be generated.
  358.  
  359. This call is only provided for advanced uses of the trackermodule, and
  360. involves information of a highly technical nature. It is advised that you
  361. do not use this call if you can avoid it.
  362.  
  363. The call will transfer the current contents of the sound voice info table
  364. to the location pointed to by R0. 256 bytes (64 words) will be transferred
  365. in total (8 words per sound channel), regardless of the number of voices
  366. actually active.
  367.  
  368. When a note is played and then ends, word 6 of the appropriate channel is
  369. zeroed. The sound routines will only try and play the sample if this word is
  370. non-zero.
  371.  
  372. When a tune is paused, the block is saved and overwritten with zeros. When
  373. the tune is restarted, the old contents are restored, so that the samples
  374. will continue to play from the same point.
  375.  
  376.  The format of the table is as follows:-
  377.  
  378. Word  Offset       Sound channel 1...
  379. 0     +0      The current pitch accumulator. (shift right 16 bits to get the
  380.               actual byte offset into the sample being played).
  381.  
  382. 1     +4      The current pitch increment (added to accumulator after every
  383.               byte filled). This is obtained using internal tables given the
  384.               sample period (word 7)
  385.  
  386. 2     +8      The sample loop offset (given in bytes). When the routine
  387.               reaches the end of a sample or the sample length, the accumul-
  388.               ator is loaded with this value shifted left 16 bits (ie. to
  389.               give a byte offset). If this is a zero value, the sample will
  390.               stop instead of looping.
  391.  
  392. 3     +12     The sample length / repeat length (in bytes). The routine
  393.               checks every 4 bytes filled to see if the current accumulator
  394.               exceeds this value when shifted right 16 bits. (See above)
  395.  
  396. 4     +16     The sample number (1-36).
  397.  
  398. 5     +20     The current volume (0-255). This value is subtracted from every
  399.               byte filled, therefore 0 = maximum volume and 255 = silent.
  400.               NB This is the reverse of the normal volume command.
  401.  
  402. 6     +24     This is the tracker format note number of the sample being
  403.               played (1-36, 1=C octave 1 36=B octave 3). The arpeggio command
  404.               makes use of this word. If this word is zero, no sound will be
  405.               played.
  406.  
  407. 7     +28     This is a copy of the sample period (from which the pitch
  408.               increment value is calculated), and is used by the portamento
  409.               commands. The range of the sample period is from 1 to hex &400
  410.               (although the portamento commands have smaller limits in
  411.               practice).
  412.  
  413. 8     +32     Word 0 of sound channel 2...
  414.  
  415. 9     +36     Word 1 of sound channel 2...  etc. 
  416.      
  417.     -> word 8 of sound channel 8
  418.  
  419.  
  420.  
  421.  
  422.  
  423. -----------------------------------------------------------------------------
  424. Tracker_ReadSampleTable   (SWI &4320C)
  425. -----------------------------------------------------------------------------
  426.  
  427. On Entry:  R0 = Sample number (1-36)
  428.  
  429. On Exit :  R0 preserved
  430.            R1 = Pointer to sample name (0-terminated, max length 22 chars)
  431.            R2 = Sample length (bytes)
  432.            R3 = Sample volume (0-255, 255=maximum volume, 0=silent)
  433.            R4 = Repeat offset (bytes)
  434.            R5 = Repeat length (bytes)
  435.            R6 = Address of raw sample data
  436.  
  437. This call returns all relevant information about the specified sample. 
  438.  
  439. If there is no tune loaded, an error will be generated.
  440.  
  441.  
  442.  
  443.  
  444. -----------------------------------------------------------------------------
  445. Tracker_Lock              (SWI &4320D)
  446. -----------------------------------------------------------------------------
  447.  
  448. On Entry:  R0 = locking code (passed in R4 to SWI's)
  449.  
  450. On Exit :  -     
  451.  
  452.  
  453.  This SWI and the corresponding Tracker_Unlock SWI are provided to
  454. prevent user intervention with any of the features of the module when this
  455. would be undesirable for any multi-tasking applications using the module 
  456. (for example issuing a *PlayStop command). By calling this SWI, an applic-
  457. ation can gain complete control of the module, but as a result, this feature
  458. must be used carefully, because the module cannot then be unlocked unless
  459. the code specified in the lock SWI is known (and if not, the module must be
  460. re-initialised).
  461.  When the module is locked, calling any commands or SWI's which alter
  462. anything (such as changing the current play position, loading or killing
  463. tunes, playing notes) will cause an error, but SWI's returning information
  464. will function as normal. For the application which is responsible for the
  465. locking to be able to use the affected SWI's, R4 must be set to the locking
  466. code (passed in R0) before any of the affected SWI's is called (no commands
  467. will work even if the locking code is known).
  468.  If the trackermodule is already 'locked' when this SWI is called, an error
  469. will be generated.
  470.  It is advisable to avoid using this call unless absolutely neccessary.
  471.            
  472.  
  473. The restricted commands are:
  474. *PlayMod, *PlayPause, *PlayStart, *PlayPos, *PlayStereo, *PlayStop.
  475.  
  476. The restricted SWI's are:                                          
  477. Tracker_Load, Tracker_MemoryLoad, Tracker_Play, Tracker_Stop, Tracker_Stereo,
  478. Tracker_SetPos, Tracker_PlayNote.
  479.  
  480.  
  481.            
  482.  
  483. -----------------------------------------------------------------------------
  484. Tracker_Unlock            (SWI &4320E)
  485. -----------------------------------------------------------------------------
  486.  
  487. On Entry:  R0 = locking code (specified in Tracker_Lock)
  488.  
  489. On Exit :  -
  490.  
  491.  
  492.  This SWI should be called to unlock the module after it has been locked with
  493. 'Tracker_Lock'. If the value passed in R0 is different to the locking code
  494. given in the lock SWI, or the module has not been locked, an error is
  495. generated.
  496.  
  497.  
  498.  
  499.  
  500.  
  501. =============================================================================
  502.  
  503. Note translation table
  504. ----------------------
  505.  
  506. The tracker format note numbers and the notes they refer to are as follows:
  507.  
  508. no.  note   sample period
  509. ---  ----   -------------
  510. 1    C -1   &358
  511. 2    C#-1   &328
  512. 3    D -1   &2FA
  513. 4    D#-1   &2D0
  514. 5    E -1   &2A6
  515. 6    F -1   &280
  516. 7    F#-1   &25C
  517. 8    G -1   &23A
  518. 9    G#-1   &21A
  519. 10   A -1   &1FC
  520. 11   A#-1   &1E0
  521. 12   B -1   &1C5
  522. 13   C -2   &1AC
  523. 14   C#-2   &194
  524. 15   D -2   &17D
  525. 16   D#-2   &168
  526. 17   E -2   &153
  527. 18   F -2   &140
  528. 19   F#-2   &12E
  529. 20   G -2   &11D
  530. 21   G#-2   &10D
  531. 22   A -2    &FE
  532. 23   A#-2    &F0
  533. 24   B -2    &E2
  534. 25   C -3    &D6
  535. 26   C#-3    &CA
  536. 27   D -3    &BE
  537. 28   D#-3    &B4
  538. 29   E -3    &AA
  539. 30   F -3    &A0
  540. 31   F#-3    &97
  541. 32   G -3    &8F
  542. 33   G#-3    &87
  543. 34   A -3    &7F
  544. 35   A#-3    &78
  545. 36   B -3    &71
  546.  
  547.  
  548. =============================================================================
  549.                                
  550. Errors
  551. ------                                                    
  552.  
  553. The error numbers and messages which the trackermodule may generate:
  554.  
  555. No tune loaded        (&43200) - an operation was attempted which requires a
  556.                                  tune to be loaded into memory beforehand
  557.                                  using *PlayMod or SWI Tracker_Load.
  558.  
  559. Sequence position out of range - The sequence position given with *PlayPos
  560.                       (&43201)   or SWI Tracker_SetPos was higher than the
  561.                                  actual number of patterns in the song.
  562.  
  563. No room for module    (&43202) - The trackermodule could not claim enough
  564.                                  RMA workspace to load the module. To get
  565.                                  more memory, quit basic to the supervisor
  566.                                  prompt, and retry. If you are using the
  567.                                  desktop instead, remove an application and
  568.                                  retry.
  569.  
  570. Channel number out of range    - The sound channel number was not a value
  571.                       (&43203)   between 1 and the number of sound channels
  572.                                  used for that particular tune.
  573.  
  574. Note number out of range       - The note number was not within the range of
  575.                       (&43205)   1-36.
  576.  
  577. Sample number out of range     - The sample number was not within the range
  578.                       (&43204)   of 1-36.
  579.  
  580. Volume out of range   (&43206) - The volume was not within the range of 0-255
  581.  
  582. Module already locked (&43207) - Tracker_Lock was called when the module
  583.                                  was already locked. The module can only be
  584.                                  unlocked when the application in control of
  585.                                  the module issues a Tracker_Unlock SWI.
  586.  
  587. Unlock failed         (&43208) - Tracker_Unlock was called but either
  588.                                  the wrong locking code was specified, or
  589.                                  the module was not locked at the time.
  590.  
  591. TrackerModule in use  (&43209) - An attempt was made to execute one of the
  592.                                  restricted commands or SWI's while the
  593.                                  module was locked (see Tracker_Lock)
  594.  
  595. =============================================================================
  596.  
  597.  
  598. This module was written for enthusiasts who wish to enjoy the benefits of the
  599. Archimedes sound system in a multi-tasking environment.
  600. Feel free to use this module in any p.d. demos or programs etc., but for any
  601. commercial use, please ask Hugo Fiennes for permission. (And upload any demos
  602. to his board [see below])
  603.  
  604. Versions 0.00 to 1.xx of the original module were written by Hugo Fiennes
  605.                       allowing the playing of any soundtracker tunes.
  606. Versions 2.00 to 2.xx were written by Fabrice Mercier and Hugo,
  607.                       playing any tracker tunes (with changes/improvements).
  608. Versions 3.00 to 4.00 were written (well, extended) by Matthew Farrow
  609.                       to allow the playing of soundtracker or tracker tunes,
  610.                       with the SWI extension from versions 4.00 onwards.
  611.  
  612. You can contact Hugo in the following ways:
  613. Voice: UK (0749) 72234 (ask for Hugo)
  614. VodaFone: (0831) 444192
  615. The World of Cryton (bbs) : UK (0749) 679794 (300-2400 - 1 line)
  616.                           : UK (0749) 670030 (300-HST/V32 - 2 lines)
  617. Mail: Prestel 045847608, CIX altman
  618. Burcott Manor, Wells, Somerset, BA5 1NH, UK
  619.  
  620. Matt Farrow:
  621. Mail: Prestel 816706758, Arcade bbs (081-654 2212) as 'Matthew Farrow'
  622. 45 Alleyn Park, Dulwich, London SE21 8AT
  623.  
  624.  
  625. =============================================================================
  626.  
  627. Updates
  628. -------
  629. Version 4.00 (from 3.04)
  630.    - SWI interface added.
  631.    - Volume translations for soundtracker modules performed correctly now (?)
  632.    - Locking system introduced
  633.    - Next pattern line played just after pattern position incremented, not
  634.      just before (so the position doesn't appear to be ahead of the music).
  635.    - Removal of more minor bugs..